/*
 * Copyright (c) ycq_work@163.com
 */

package com.mxg.blog.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mxg.blog.entity.ArticleCategory;
import com.mxg.blog.mapper.ArticleCategoryMapper;
import com.mxg.blog.service.ArticleCategoryService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: ycq_work@163.com
 * @DATE: 2023/5/13 10:36
 * 实现文章接口
 */
@Service
public class ArticleCategoryServiceImpl extends ServiceImpl<ArticleCategoryMapper, ArticleCategory> implements ArticleCategoryService {
    private final ArticleCategoryMapper articleCategoryMapper;

    public ArticleCategoryServiceImpl(ArticleCategoryMapper articleCategoryMapper){
        this.articleCategoryMapper = articleCategoryMapper;
    }

    @Override
    public List<ArticleCategory> getArticleCategory(){
        return articleCategoryMapper.getArticleCategory();
    }

    @Override
    public List<String> getArticleCategoryName()
    {
        return articleCategoryMapper.getArticleCategoryName();
    }

    @Override
    public ArticleCategory getArticleCategoryIdByName(String articleCategoryName){
        return articleCategoryMapper.getArticleCategoryIdByName(articleCategoryName);
    }

    // 根据分类id, 获取分类名称
    @Override
    public ArticleCategory getArticleCategoryNameById(Integer articleCategoryId){
        return articleCategoryMapper.getArticleCategoryNameById(articleCategoryId);
    }

    // 删除分类
    @Override
    public void deleteArticleCategoryByIds(Integer articleCategoryId){
        articleCategoryMapper.deleteArticleCategoryByIds(articleCategoryId);
    }

    // 添加分类
    public void addArticleCategory(String articleCategoryName){
        articleCategoryMapper.addArticleCategory(articleCategoryName);
    }
}
